#ifndef _CONTEXT_H_
#define _CONTEXT_H_

#define CTX_LINE_MAX	1024

typedef struct ctx{
	unsigned int	num;
	int				total_freq;
	int *			uni;	//unigram list
	int *			bi;		//bigram matrix
	char *			map;	//role map
} ctx;

#define ctx_get_uni(p, i) ((p)->uni[(i)])
#define ctx_get_bi(p, i, j)	((p)->bi[(i) * (p)->num + (j)])
#define ctx_mapping(p, i) ((p)->map[(i)])
ctx * ctx_new();
int ctx_free(ctx * p);
int ctx_load(ctx * p, const char * ctx_path);
/*
int ctx_get_uni(const ctx * p, unsigned int i);
int ctx_get_bi(const ctx * p, unsigned int i, unsigned int j);
char ctx_mapping(const ctx * p, unsigned int i);
*/
#endif
